#include <stdio.h>
#include <math.h>
#include <sys/time.h>

int benchmark(void) {
    int i;
    double temp, res = 0.;
    struct timeval start, end;
    
    gettimeofday(&start, NULL);
    
    for(i = 1; i < 8000*1000; i++) {
        temp = 1. / (double) i;
        res += temp * temp;
        res *= sqrt(res + 1.) / sqrt(res);
    }
    
    gettimeofday(&end, NULL);
    
    temp = 1000. / (end.tv_sec - start.tv_sec + (end.tv_usec - start.tv_usec) * 1.e-6);
    return (int)temp;
}
